#include<bits/stdc++.h>
using namespace std;
int k[1000000010];
int main()
{
	freopen("inn.in","r",stdin);
	freopen("in.in","w",stdout);
	int n=0;
	while(scanf("%d",&k[++n])==1);
	--n;
	printf("%d %d %d\n",k[n-2],k[n-1],k[n]);
	k[n-1]*=3;
	k[n]*=2;
	for(int i=1;i<=k[n-1];i+=3)
		printf("%d %d %d\n",k[i],k[i+1],k[i+2]);
	for(int i=k[n-1]+1;i<=k[n-1]+k[n];i+=2)printf("%d %d\n",k[i],k[i+1]);
	return 0;
}
